package com.lyy.assess;

import java.util.ArrayList;
import java.util.List;

import com.example.third.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class AssessAdapter extends BaseAdapter {
	LayoutInflater mInflater;
	Context context;
	ViewHolder mHolder;
	List<AssessBean> list = new ArrayList<AssessBean>();

	public AssessAdapter(Context context, List<AssessBean> list) {
		super();
		this.context = context;
		this.list = list;
		mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.item_assess, null);
			mHolder = new ViewHolder();
			mHolder.pj_content = (TextView) convertView
					.findViewById(R.id.pj_content);
			mHolder.pj_username = (TextView) convertView
					.findViewById(R.id.pj_username);
			mHolder.pj_time = (TextView) convertView.findViewById(R.id.pj_time);
			convertView.setTag(mHolder);
		} else {
			mHolder = (ViewHolder) convertView.getTag();

		}
		mHolder.pj_content.setText(list.get(position).getText());
		mHolder.pj_username.setText(list.get(position).getU_id() + "");
		mHolder.pj_time.setText(list.get(position).getTime());

		return convertView;
	}

	class ViewHolder {
		TextView pj_content, pj_username, pj_time;

	}
}
